import Vue from "vue";
import vueRouter from 'vue-router'
import Home from '../pages/Home'
import List from '../pages/List'
import Music from '../pages/Home/Music'
import Play from '../pages/Home/Play'
import Work from '../pages/Home/Work'
Vue.use(vueRouter)
export default new vueRouter({
    // 路由模式的切换,在路由配置中将mode改为需要配置的模式
    mode: 'history',
    routes: [
        {
            // 可以通过给'/'添加重定向的方式给页面添加首页
            path: '/',
            redirect: '/home'
        },
        {
            path: '/home',
            component: Home,
            //路由的重定向,在vue中提供了一种类似Navigation to='' 的一种重定向方式
            // redirect ='转向的地址'
            redirect: "/home/music",
            //也可以通过给二级路由添加redirect 的方式添加打开一级路由后直接显示的二级路由
            children: [
                {
                    path: '/home/music',
                    component: Music,
                },
                {
                    path: '/home/play',
                    component: Play,
                    name: 'play'
                },
                {
                    path: '/home/work',
                    component: Work,
                },
            ]
        },
        {
            path: '/list',
            component: List,
        },
    ]
})